<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>login</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/login.css">
    <script type="text/javascript" src="js/jquery.min.js"></script>
</head>

<body>
    <div class="container-login">
        <div class="container-pic">
            <img src="pic/computer.png" width="350px">
        </div>
        <div class="login-dialog">
            <h3>管理员认证</h3>
            <div class="row">
                <span>认证码</span>
                <input type="text" name="code" id="code" class="form-control" placeholder="请输入认证码">
            </div>
            <div class="row">
                <button type="button" class="btn btn-info btn-lg" onclick="verify()">认证</button>
            </div>
        </div>
    </div>
    <script src="js/jquery.min.js"></script>
    <script src="js/common.js"></script>
    <script>
        function verify() {
            $.ajax({
                url:"/user/adminSignUp",
                type:"post",
                data:{
                    code: $("#code").val()
                },
                success:function(result) {
                    if(result.code == "SUCCESS") {
                        alert("认证成功");
                        //localStorage.setItem("user_token", result.data);
                        location.href = "bookList.html";
                    }else{
                        alert(result.errMsg);
                    }
                },
                error: function (error) {
                    if (error != null && error.status == 401) {
                        alert("用户未登录");
                        location.href = "login.html";
                    }
                }
            });
        }
    </script>
</body>

</html>